package com.colodoo.code.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

/**
 * @author zhisan
 */
@Entity
@Table(name = "code_column_inf")
@Getter
@Setter
public class ColumnInf implements Serializable {

	/**
	 * 字段ID
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "column_id")
	private Integer columnId;

	/**
	 * 字段名
	 */
	@Column(name = "column_name")
	private String columnName;

	/**
	 * 字段类型
	 */
	@Column(name = "column_type")
	private String columnType;

	/**
	 * 字段长度
	 */
	@Column(name = "column_length")
	private Integer columnLength;

	/**
	 * 字段精度
	 */
	@Column(name = "column_precision")
	private Integer columnPrecision;

	/**
	 * 字段是否可空
	 */
	@Column(name = "column_enable_null")
	private Boolean columnEnableNull;

	/**
	 * 字段注释
	 */
	@Column(name = "column_comment")
	private String columnComment;

	/**
	 * 字段排序
	 */
	@Column(name = "column_sort")
	private Integer columnSort;

	/**
	 * 模块
	 */
	@ManyToMany(mappedBy = "columns")
	@JsonIgnore
	private Set<TableInf> tables = new HashSet<TableInf>();

}
